package com.tuo51.evaluate.domain.appusers;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.tuo51.foudation.model.Domain;
import lombok.Data;

import javax.persistence.*;

/**
 * 兑换码
 */

@Data
@Entity
@Table(name = "redeem_code")
@JsonIgnoreProperties(value = { "hibernateLazyInitializer"})
public class RedeemCode extends Domain {

	@Column(name = "code", columnDefinition = "varchar(10) COMMENT '兑换码' ", unique = true)
	private String code;

	@Column(name = "product_id")
	private Long productId;  // always leads to vip id

//	@JsonIgnore
	@OneToOne
	@JoinColumn(name = "product_id", insertable = false, updatable = false)
	private Vip product;


	@Column(name = "comment")
    private String comment;

	@Column(name = "dealer")
    private String dealer;

	@Column(name = "dealer_phone")
	private String dealerPhone;

	//总次数， 可用次数等于 总数量 - 销售数量
	@Column(name = "sales_quota", columnDefinition = "int default 0 COMMENT '销售配额' ")
	private Integer salesQuota;

	//销售数量
    @Column(name = "sales_quantity", columnDefinition = "int default 0 COMMENT '销售数量' ")
    private Integer salesQuantity;



}
